package com.weixing.mall.provider.controller.front;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoRepeatSubmit;
import com.weixing.mall.core.support.auth.SysAuth;
import com.weixing.mall.core.support.auth.SysInfo;
import com.weixing.mall.provider.model.dto.AfterSaleOperationDto;
import com.weixing.mall.provider.model.query.AfterSaleOperationQuery;
import com.weixing.mall.provider.model.vo.AfterSaleOperationVo;
import com.weixing.mall.provider.service.IAfterSaleOperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName AfterSaleOperationController
 * @Description TODO <br/>
 * @Author gjq
 * @Modified By:
 * @Date 2019/10/11
 * @Version 1.0
 **/
@RestController
@RequestMapping("front/afterSaleOperation")
@Api(value = "前端：售后操作记录APi", tags = "前端：售后操作记录")
public class FrontAfterSaleOperationController {

    @Autowired
    private IAfterSaleOperationService afterSaleOperationService;

    @ApiOperation(value = "加载售后操作列表")
    @GetMapping("getOrderOperation")
    public Result getOrderList(@RequestBody AfterSaleOperationQuery afterSaleOperationQuery) {
        List<AfterSaleOperationVo> list = afterSaleOperationService.selectList(afterSaleOperationQuery);
        return ResultUtil.success(list);
    }

    @ApiOperation(value = "保存售后操作")
    @PostMapping("save")
    @NoRepeatSubmit
    public Result save(@SysInfo SysAuth auth, @RequestBody AfterSaleOperationDto afterSaleOperationDto) {
        afterSaleOperationService.save(afterSaleOperationDto, auth.getUid());
        return ResultUtil.success();
    }
}
